{include app:admin.inc.header}
<!--tmpl-resource-->
{include app:admin.inc.top}


<div class="container-fluid content-body">
    <div class="main">
        <!-- left side start-->
        <section class="left-section">
            <dl id="leftNav" data-type="product">
                <dt><i class="glyphicon glyphicon-record"></i>商品管理</dt>
               {if in_case_array('admin/product/add',$priv) || empty($priv)}
                <dd><a class="mb active" href="{url /admin/product/add}">商品发布</a></dd>
                {/if}
                {if in_case_array('admin/product/indexBySale',$priv) || empty($priv)}
                <dd><a class="mbh" href="{url /admin/product/indexBySale}">出售中的商品</a></dd>
               {/if}
                {if in_case_array('admin/product/indexByStore',$priv) || empty($priv)}
                <dd><a class="mbh" href="{url /admin/product/indexByStore}">仓库中的商品</a></dd>
                {/if}
                {if in_case_array('admin/repertory',$priv) || empty($priv)}
                 <dd><a class="mbh" href="{url /admin/repertory/index}">仓库信息</a></dd>
                {/if}
            </dl>
        </section>
        <!-- left side end-->


        <!-- main content start-->
        <section class="right-section" id="right-section">
            {include admin.inc.bread}
            <h2 class="header">{$title}</h2>
            <!-- start of inner-frame -->
            <div class="inner-iframe">
                <!-- Nav tabs -->
                <div class="inner-container">
                    <form role="form" class="form-horizontal basicForm content-add-form" id="content-add-form"
                          autocomplete="off" action="{$do_add_url}" onsubmit="return false">
                        
                        <div id="fourLinkage"
                             style="border-top:1px solid #eee;border-bottom:1px solid #eee;padding: 10px 0px;margin: 0px 0px 10px;">

                            <div class="form-group">
                                <label class="col-sm-2 control-label"><span class="asterisk">*</span>货品类型</label>
                                <div class="col-sm-4">

                                    <select class="form-control select_type " id="select_type" name="data[type_name_id]"
                                            required cname="货品类型"
                                            data-name="货品类型">
                                        <option value="" selected="selected">请选择类型</option>
                                    </select>
                                    <input type="hidden" name="data[type_name]">

                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label"><span class="asterisk">*</span>货品名称</label>
                                <div class="col-sm-4">

                                    <select class="form-control select_pro " id="select_pro"
                                            name="data[product_name_id]" required cname="货品名称"
                                            data-name="货品名称">
                                        <option value="" selected="selected">请选择品名</option>

                                    </select>
                                    <input type="hidden" name="data[product_name]">

                                </div>

                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label"><span class="asterisk">*</span>货品厂家</label>
                                <div class="col-sm-4">

                                    <select class="form-control select_fac " name="data[factory_name_id]" required
                                            cname="货品厂家" data-name="货品厂家">
                                        <option value="" selected="selected">请选择厂家</option>

                                    </select>
                                    <input type="hidden" name="data[factory_name]">

                                </div>


                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label"><span class="asterisk">*</span>货品牌号</label>
                                <div class="col-sm-4">

                                    <select class="form-control select_bra " name="data[brand_name_id]" required
                                            cname="货品牌号" data-name="货品牌号">
                                        <option value="" selected="selected">请选择牌号</option>

                                    </select>
                                    <input type="hidden" name="data[brand_name]">
                                    <input type="hidden" name="data[tpfb]">


                                </div>
                                <p class="help-block">

                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">质量等级 </label>
                                <div class="col-sm-4">

                                    <input dtype="" class="form-control"  name="data[level]"
                                           placeholder="质量等级"  cname="质量等级"data-name="质量等级" value=""/>
                                    <label class="help-block"></label>

                                </div>

                            </div>
                        </div>

                        <!--tmpl-fields-->
                       <h2 class="header">商品属性</h2>
                        <div style="border-top:1px solid #eee;border-bottom:1px solid #eee;padding: 10px 0px;margin: 0px 0px 10px;">


                            <div class="form-group">
                                <label class="col-sm-2 control-label"><span
                                        class="asterisk">*</span>货品规格（{$pro_std}）</label>
                                <div class="col-sm-4">

                                    <input type="text" class="form-control" maxlength="7" required cname="货品规格" name="data[pkg_size]"placeholder="货品规格"
                                           value=""
                                           data-name="货品规格">
                                </div>
                                <p class="help-block">

                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label"><span class="asterisk">*</span>货号 </label>
                                <div class="col-sm-4">

                                    <input dtype="" class="form-control" maxlength="25" name="data[product_no]"
                                           placeholder="产品货号" cname="产品货号" readonly="true" value=""/>

                                </div>
                                <p class="help-block"></p>

                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">计价类型</label>
                                <div class="col-sm-4">
                                    <div class="rdio rdio-default">
                                        <input type="radio" name="data[valuation_type]" value="0" id="radioPrimary1"
                                               checked="checked">
                                        <label for="radioPrimary1">普通新料</label>
                                    </div>
                                    <div class="rdio rdio-primary">
                                        <input type="radio" name="data[valuation_type]" value="1" id="radioPrimary2">
                                        <label for="radioPrimary2">粉料及弹性料</label>
                                    </div>
                                    <div class="rdio rdio-primary">
                                        <input type="radio" name="data[valuation_type]" value="2" id="radioPrimary3">
                                        <label for="radioPrimary3">太空包</label>
                                    </div>
                                    <div class="rdio rdio-primary">
                                        <input type="radio" name="data[valuation_type]" value="3" id="radioPrimary4">
                                        <label for="radioPrimary4">改性料</label>
                                    </div>
                                </div>
                                <p class="help-block"></p>

                            </div>


                            <!-- input -->
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><span class="asterisk">*</span>数量(库存数量)({$pro_unit}) </label>
                                <div class="col-sm-4">

                                    <input dtype="" class="form-control"  name="data[quantity]"
                                           placeholder="数量(库存数量)" required cname="数量(库存数量)"data-name="数量(库存数量)" value=""/>
                                    <label class="help-block"></label>

                                </div>

                            </div>

                            <!-- input -->
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><span class="asterisk">*</span>最小交易量({$pro_unit}) </label>
                                <div class="col-sm-4">

                                    <input dtype="number" class="form-control" maxlength="{maxlength}" name="data[min_volume]"
                                           placeholder="最小交易量" required cname="最小交易量" data-name="最小交易量" value=""/>
                                </div>
                                <p class="help-block"></p>

                            </div>

                            <!-- input -->
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><span class="asterisk">*</span>销售价(元/{$pro_unit}) </label>
                                <div class="col-sm-4">
                                    <input dtype="number" class="form-control" maxlength="{maxlength}"
                                           name="data[sales_price]" placeholder="销售价" required cname="销售价"
                                           data-name="销售价" value=""/>
                                </div>
                                <p class="help-block"></p>

                            </div>

                            <!-- input -->
                            <div class="form-group">
                                <label class="col-sm-2 control-label">成本价(元/{$pro_unit}) </label>
                                <div class="col-sm-4">

                                    <input dtype="number" class="form-control" maxlength="{maxlength}" name="data[cost_price]"
                                           placeholder="成本价" cname="成本价" data-name="成本价" value=""/>
                                </div>
                                <p class="help-block"></p>

                            </div>
                            <!-- input -->
                            <div class="form-group">
                                <label class="col-sm-2 control-label">货品介绍 </label>
                                <div class="col-sm-8">
                                <textarea class="form-control editor" style="width: 100%; height: 300px;"
                                          name="data[product_summary]" placeholder="货品介绍" cname="货品介绍" data-name="货品介绍"></textarea>
                                </div>
                                <div style="color:#f00">
                                    <span class="word_surplus"></span>
                                </div>
                                <p class="help-block"></p>

                            </div>
                        </div>
                        <h2 class="header">销售设置</h2>
                        <div style="border-top:1px solid #eee;border-bottom:1px solid #eee;padding: 10px 0px;margin: 0px 0px 10px;">


                            <div class="form-group">
                                <label class="col-sm-2 control-label"><span class="asterisk">*</span>交收方式</label>
                                <div class="col-sm-4">
                                    <div class="rdio rdio-default">
                                        <input type="radio" name="data[delivery_way]" value="0" id="radio1"
                                               checked="checked">
                                        <label for="radio1">卖家配送</label>
                                    </div>
                                    <div class="rdio rdio-primary">
                                        <input type="radio" name="data[delivery_way]" value="1" id="radio2">
                                        <label for="radio2">买家自提</label>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">

                                <label class="col-sm-2 control-label"><span class="asterisk">*</span>交收仓库</label>
                                <div class="col-sm-4">
                                    {setSelectOptions $repertoryList data[repertory_id] 0 '请选择仓库' 'required cname="仓库" data-name="仓库"'}
                                </div>
                                <p class="help-block"></p>

                            </div>

                            <div id="repertory_info"></div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label"><span class="asterisk">*</span>发布方式</label>
                                <div class="col-sm-4">
                                    <div class="rdio rdio-primary">
                                        <input type="radio" name="data[publish_way]" value="1" id="radio113" checked="checked" required cname="发布方式">
                                        <label for="radio113">公开</label>
                                    </div>


                                    <div class="rdio rdio-primary">
                                        <input type="radio" name="data[publish_way]" value="2" id="radio112" required cname="发布方式">
                                        <label for="radio112">指定会员</label>
                                    </div>
                                    <div class="rdio rdio-default">
                                        <input type="radio" name="data[publish_way]" value="3" id="radio111"
                                               required cname="发布方式">
                                        <label for="radio111">公开和指定会员</label>
                                    </div>
                                    <input type="hidden" name="data[publish_way_is_members]" value="">

                                    <table class="publish_way_is_members_name" style="border-top: 1px #ccc solid; margin-left: 17px;">

                                    </table>
                                </div>
                                <p class="help-block"></p>

                            </div>
                            <input type="hidden" name="data[member_sales_price]" value="">
                            <input type="hidden" name="data[member_delivery_way]" value="0">
                            <input type="hidden" name="data[status]" value="1">

                        </div>
                        <!--tmpl-assocfields-->
                        <div class="btn-group btn-group-or col-sm-offset-2 inline-top">
                            <!--
                            <a href="{if $id==''}{$do_add_url}{else}{$do_edit_url}?id={$id}{/if}"
                               class="btn btn-primary ajaxproxy"
                               proxy='{"method":"post", "location":"indexBySale"}'>提交保存</a>-->

                            <button class="btnsm mb btn-add-sale">提交发布</button>

                            <span class="or">OR</span>

                            <button class="btnsm mc mch btn-add-repertory">加入仓库</button>


                        </div>
                    </form><!-- content add form -->
                </div>
            </div><!-- end of inner -->
        </section>
    </div>
</div>
{include admin.inc.footer}

<!--tmpl-script-->
<script id="publish_way_is_members" type="text/template">

    <div class="tab-content">
        <div style="float: left;width: 300px;border-right: 1px solid #ccc;">

            <div class="form-group input-group" style="padding:3px 9px;">
                <input type="text" name="input-tree-search" class="form-control" placeholder="会员"  cname="会员">
                <span class="input-group-btn">
                     <button class="btn btn-default btn-tree-search" type="button"><i class="glyphicon glyphicon-search"></i>
                     </button>
               </span>
            </div>
            <div class="zTreeDemoBackground left">
                <ul id="treeDemo" class="ztree"></ul>
            </div>
        </div>
        <form role="form" id="member_form" class="form-horizontal basicForm"  autocomplete="off" onsubmit="return false">


        <div id="edit-add-box"
             style="float:right;width: 470px;overflow: hidden;margin: auto 1% auto auto;padding: 12px 5px;">
            <h5>所选会员</h5>
            <div id="checked_members" style="border-top:1px solid #eee;padding: 10px 0px;margin: 0px 0px 10px;">
            </div>
            <input type="hidden" id="checked_members_value" placeholder="指定会员" required cname="指定会员"
                   data-name="指定会员" />
            <label id="checked_members_value-error" class="error" style="display: none">请指定会员</label>

            <p class="help-block"></p>
            <h5>销售设置</h5>
            <div style="border-top:1px solid #eee;border-bottom:1px solid #eee;padding: 10px 0px;margin: 0px 0px 10px;">

                <div class="form-group">
                    <label class="col-sm-3 control-label" style="text-align: left"><span class="asterisk">*</span>销售价 </label>
                    <div class="col-sm-4">
                        <input dtype="number" class="form-control" maxlength="{maxlength}"
                               name="member_sales_price" id="member_sales_price" placeholder="销售价" required cname="销售价"
                               data-name="销售价" value=""/>
                    </div>
                    <p class="help-block"></p>

                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label" style="text-align: left"><span class="asterisk">*</span>交收方式</label>
                    <div class="col-sm-4">
                        <div class="rdio rdio-default">
                            <input type="radio" name="member_delivery_way" value="0" id="radio11"
                                   checked="checked">
                            <label for="radio11">卖家配送</label>
                        </div>
                        <div class="rdio rdio-primary">
                            <input type="radio" name="member_delivery_way" value="1" id="radio12">
                            <label for="radio12">买家自提</label>
                        </div>
                    </div>
                </div>

           </div>
        </div>
        </form>

    </div>
</script>
<!-- pagescript -->
<script type="text/javascript">
    seajs.use("admin/productadd", function (parameter) {

        parameter.editor();

        parameter.upload_url = "{$upload_url}";
        parameter.image_search_url = "{$image_search_url}";
        parameter.image_list_url = "{$image_list_url}";
        parameter.zNodes = {$groupMembers};
        parameter.initByAdd();
    });
</script>


<script id="assocpage" type="text/html">
    <div class="text-right">
        <ul class="pagination blog-pagination">
            <li><a class="assoc-page" data-page="{[prev]}" href="javascript:void(0);">上一页</a></li>
            {[loop pages page]}

            <li><a class="assoc-page" data-page="{[page]}" {[if curr== page]}class="active" {[/if]}
                href="javascript:void(0)">{[page]}</a></li>

            {[/loop]}
            <li><a class="assoc-page" href="javascript:void(0);" data-page="{[nexts]}">下一页</a></li>
        </ul>
    </div>
</script>

</body>
</html>
